package com.motu.vertx.module.utility.monitor;


public class GateMonitorManager {
    private static int packageNum = 0;//数据包数量
    private static int requestDataSize = 0;//上行数据包大小
    private static int responseDataSize = 0;//下行数据包大小
    private static long dealTime = 0;//响应时间（毫秒）
    private static long timeoutNum = 0;//超时命令数量

    private static int initPackageNum = 0;//init协议数据包数量
    private static int initResponseDataSize = 0;//init协议下行包大小
    private static long initDealTime = 0;//init协议响应时间（毫秒）

    public static void resetAll(){
        packageNum = 0;//数据包数量
        requestDataSize = 0;//上行数据包大小
        responseDataSize = 0;//下行数据包大小
        dealTime = 0;//响应时间（毫秒）
        timeoutNum = 0;//超时命令数量

        initPackageNum = 0;//init协议数据包数量
        initResponseDataSize = 0;//init协议下行包大小
        initDealTime = 0;//init协议响应时间（毫秒）
    }
    public static void addMonitorData(boolean isInitCmd,int reqDataSize,int resDataSize,long dTime){
        packageNum ++;
        requestDataSize += reqDataSize;
        responseDataSize += resDataSize;
        dealTime += dTime;
        if(isInitCmd){
            initPackageNum ++;
            initResponseDataSize += resDataSize;
            initDealTime += dTime;
        }
    }

    public static void addMonitorData(boolean isInitCmd,int reqDataSize,int resDataSize,long dTime, boolean timeout){
        packageNum ++;
        requestDataSize += reqDataSize;
        responseDataSize += resDataSize;
        dealTime += dTime;
        if (timeout){
            timeoutNum++;
        }
        if(isInitCmd){
            initPackageNum ++;
            initResponseDataSize += resDataSize;
            initDealTime += dTime;
        }
    }

    public static int getPackageNum() {
        return packageNum;
    }

    public static int getRequestDataSize() {
        return requestDataSize;
    }

    public static int getResponseDataSize() {
        return responseDataSize;
    }

    public static long getDealTime() {
        return dealTime;
    }

    public static int getInitPackageNum() {
        return initPackageNum;
    }

    public static int getInitResponseDataSize() {
        return initResponseDataSize;
    }

    public static long getInitDealTime() {
        return initDealTime;
    }

    public static long getTimeoutNum() {
        return timeoutNum;
    }

}
